﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using BOHVote.BLL;
using BOHVote.Entity;
 

namespace BOH.Information
{
    public partial class OverView : System.Web.UI.Page
    {
        string strApplyPeriodID = string.Empty;
        BHUser user = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] != null)
            {
                user = (BHUser)Session["User"];
                if (!IsPostBack)
                {
                    FillForm();
                }
           
                if (user.RightType == "A" || user.RightType == "C")
                {
                    divShow.Visible = true;
                    lblNomalApply.Text = ApplyClass.getNomalApply(strApplyPeriodID).ToString();
                    lblTApply.Text = ApplyClass.getCountApplyR(strApplyPeriodID).ToString();
                    lblSApply.Text = ApplyClass.getCountApplyS(strApplyPeriodID).ToString();
                }
                else
                    divShow.Visible = false;
            }
        }

        public void FillForm()
        {
            DataSet dstPeriod = PeriodClass.getAperiod();
            string strPeriod = dstPeriod.Tables[0].Rows[0]["ApplyPeriodName"].ToString();
            strApplyPeriodID = dstPeriod.Tables[0].Rows[0]["ApplyPeriodID"].ToString();
            lblCurrentPeriod.Text = strPeriod;
            if (user.RightType == "Z" || user.RightType == "A")
                lblCountApply.Text = ApplyClass.CountApply(strApplyPeriodID, "", "").ToString();
            else
                lblCountApply.Text = ApplyClass.CountApply(strApplyPeriodID, user.UnitID, user.GovernID).ToString();
        }
    }
}
